﻿using Homework.Model.homework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework.DAL
{
    public class UserDAL
    {
        MyDbContext DB;
        public UserDAL(MyDbContext db) 
        {
        this.DB = db;
        }
        public dynamic Login(string name,string pwd)
        {
            try
            {
                UserLogin list = DB.userLogins.Where(x => x.Name == name).FirstOrDefault();
                if (list == null)
                {
                    return -1;
                }
                if (pwd != list.Password)
                {
                    return -2;
                }
                return list;
            }
            catch (Exception)
            {

                throw;
            }
           
        }
    }
}
